import random
num=random.randint(1,100)
i=0
print(num)

flag=True
while flag:
    i+=1
    guess_num=int(input("请输入你要猜的数"))
    if guess_num==num:
        print("猜中了")
        flag=False
    else:
        if guess_num>num:
            print("猜大了")
        else:
            print("猜小了")
print(f"总共猜了{i}次")